Fix bazel build //... failure caused by missing JSON schema files in Sphinx source tree#201
Conversation
License Check Results🚀 The license check job ran with the Bazel command: bazel run --lockfile_mode=error //:license-checkStatus: Click to expand output |
|
The created documentation from the pull request is available at: docu-html |
a5f9b1b to
92ae971
Compare
| filegroup( | ||
| name = "config_schema_files", | ||
| srcs = glob(["**/*.json"]), | ||
| visibility = ["//visibility:public"], |
There was a problem hiding this comment.
I think the global expression subsumes the json schema, but also the default values json files and the example configuration. Making all these files publicly accessible via bazel.
While you could argue the json schema should be public for users to validate their config manually if they wish, the other json files are only for our documentation build.
I am wondering if it makes sense to split this into the json schema that should be public and the other json files as private. So that only make artifacts public that are meant to be public. Or alternatively, changing the visibility to making the whole file group only visible within the lifecycle repo.
|
For me |
|
I don't get that error. I'm using a clean devcontainer
You are missing the |
Okay, then its fine. I was only building without the "--config" because the PR description states that |
I will edit the description |
Problem
bazel build --config=x86_64-linux //...was failing becauseliteralincludedirectives in the docstraversed up from the Sphinx source tree to
src/…, but Bazel's sandbox onlypopulates the execroot — not the
_sources/directory that Sphinx operates in.This caused the build to break for any contributor running a top-level build.
Root Cause
When Sphinx runs inside a Bazel action (
//:needs_json), the CWD is theexecroot and JSON schema files are linked there at their workspace-relative
paths. However, the Sphinx source tree lives under
bazel-out/…/_needs_json/_sources/, which Bazel does not populate with thosefiles automatically.
literalincludedirectives traversing up tosrc/…therefore resolved to
_sources/src/…, which didn't exist.Changes
BUILD— adds//src/launch_manager_daemon/config/config_schema:config_schema_filesas a data dependency of the
docstarget so the schema files are available inthe sandbox.
src/launch_manager_daemon/config/config_schema/BUILD— introduces aconfig_schema_filesfilegroup that exposes all JSON files under the directorywith public visibility.
docs/conf.py— adds asetup()hook that copies the schema files fromthe execroot into the Sphinx source tree at the path
literalincludeexpects.The copy is guarded so it is a no-op for non-Bazel runs (local
sphinx-buildor
bazel run //:docs) where the files already exist at the expected location.Testing
Notes
docsmacro were modified.conf.pycopy is intentionally defensive (if src_json_dir.exists() and not dest_json_dir.exists()) to avoid interfering with incremental builds orlocal workflows.
Closes #199